package com.example.actordemo3.client;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.cluster.client.ClusterClientReceptionist;
import com.example.actordemo3.cluster.ClusterActor;
import com.typesafe.config.ConfigFactory;

public class ServeClient {

    public static void main(String[] args) {
        ActorSystem system1 = ActorSystem.create("sys",
                ConfigFactory.load("cluster1.conf"));
        ActorRef actorRef1 = system1.actorOf(Props.create(ClientDemo.class), "clientDemo");


        ActorSystem system2 = ActorSystem.create("sys",
                ConfigFactory.load("cluster2.conf"));
        ActorRef actorRef2 = system2.actorOf(Props.create(ClientDemo.class),"clientDemo1");

        ActorSystem system3 = ActorSystem.create("sys",
                ConfigFactory.load("cluster3.conf"));
        ActorRef actorRef3 = system3.actorOf(Props.create(ClientDemo.class),"clientDemo");

        ClusterClientReceptionist.get(system1).registerService(actorRef1);
        ClusterClientReceptionist.get(system2).registerService(actorRef2);
        ClusterClientReceptionist.get(system3).registerService(actorRef3);
    }
}
